﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="ReceiveInvoice.aspx.cs" Inherits="Admin_ReceiveInvoice" Title="Received Invoices List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Check Invoice List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script>
        function pageLoad() {
            $('#<%=tb_InvoiceNumber.ClientID %>').focus();
        }

    </script>

    <asp:Panel ID="pn_Add" runat="server" DefaultButton="btn_Add">
        <table>
            <tr>
                <td>
                    Invoice Number:
                </td>
                <td>
                    <asp:TextBox ID="tb_InvoiceNumber" CssClass="text-input" runat="server"></asp:TextBox>
                </td>
                <td>
                    <asp:Button ID="btn_Add" runat="server" Text="Add" CssClass="button" OnClick="btn_Add_Click" />
                    <asp:Button ID="btn_Print" runat="server" Text="Print" CssClass="button" OnClick="btn_Print_Click" />
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                </td>
                <td>
                </td>
            </tr>
        </table>
    </asp:Panel>
    <br />
    <h3>
        Received Invoices</h3>
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="CheckInvoiceDataSource"
        DataKeyNames="VatInvoiceNumber" AllowMultiColumnSorting="False" DefaultSortColumnName="[VATInvoiceNumber]"
        DefaultSortDirection="Ascending" ExcelExportFileName="Export_CheckInvoice.xls"
        AllowExportToExcel="True" AllowPaging="True" AllowSorting="True" ExportToExcelText="Excel"
        PageSelectorPageSizeInterval="10" RecordsCount="0" ShowGridOnEmptyData="False">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" DeleteText="Remove" />
            <asp:BoundField DataField="VatInvoiceNumber" HeaderText="Vat Invoice Number" SortExpression="[VATInvoiceNumber]"
                ReadOnly="True" />
            <asp:TemplateField HeaderText="File Copy" SortExpression="[FileCopy]">
                <ItemTemplate>
                    <%# (Boolean.Parse(Eval("FileCopy").ToString())) ? "YES" : "NO" %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Customer Copy" SortExpression="[CustomerCopy]">
                <ItemTemplate>
                    <%# (Boolean.Parse(Eval("CustomerCopy").ToString())) ? "YES" : "NO"%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="CheckDate" HeaderText="Receive Date" SortExpression="[CheckDate]"
                DataFormatString="{0:d}" HtmlEncode="False" />
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
        </Columns>
        <EmptyDataTemplate>
            <b>No Received Invoices Found!</b>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <br />
    <data:CheckInvoiceDataSource ID="CheckInvoiceDataSource" runat="server" SelectMethod="GetPaged"
        EnablePaging="True" EnableSorting="True">
        <Parameters>
            <data:CustomParameter Name="WhereClause" Value="DATEDIFF(dd,CheckDate,GETDATE())=0"
                ConvertEmptyStringToNull="false" />
            <data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" />
            <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                Type="Int32" />
            <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                Type="Int32" />
            <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
        </Parameters>
    </data:CheckInvoiceDataSource>
</asp:Content>
